import { createRouter, createWebHistory } from "vue-router"
import {useCookies} from "vue3-cookies"
import userData from "../pages/mianPages/userData.vue"
import axios from "axios"

const {cookies} = useCookies()
const routes = [
    {
        path:"/mianPages/userData",
        component:()=>import("../pages/mianPages/userData.vue"),
        name:"userData",
    },
    {
        path:"/login",
        component:()=>import("../pages/mianPages/login/loginBackground.vue"),
        name:"loginBackground",
        children:[
            {
                path:"/login/welcome",
                component:()=>import("../pages/mianPages/login/welcome.vue"),
                name:"welcome"
            },{
                path:"/login/signIn",
                component:()=>import("../pages/mianPages/login/signIn.vue"),
                name:"signIn"
            },{
                path:"/login/login",
                component:()=>import("../pages/mianPages/login/login.vue"),
                name:"login"
            }
        ]
    }
]
const router = new createRouter({
    history:createWebHistory(),
    routes
})
router.beforeEach((to, from, next) => {
    cookies.set('k2', 'v2', '1h')
    next();
})
export default router